package com.hsy.swu.clouddb

class Comment(
    var objectId: String,
    var likeCounts: Int,
    var likeUsers: String,
    var commentatorId: String,
    var commentatorNickName: String,
    var content: String,
    var createdAt: String = "",
    var updatedAt: String = "",
) {
    fun isCurrentUserLikeThisComment(): Boolean {
        if (newLikeState != null) return newLikeState!! // 有新值就用新的
        return likeUsers.contains("${MyUser.currentUser.objectId}-${MyUser.currentUser.nickName}")
    }

    /** 点赞后，leanCloud数据会变，但已经显示在评论区的数据不会变，因此在用 RV显示时，bind会用之前的状态 */
    var newLikeState: Boolean? = null
    var newLikeCounts: Int? = null
}